package com.shop.common.tmpl;

import com.shop.common.model.ServiceBean;

public class BaseService {
    public static<T> ServiceBean<T> resultModel(boolean success, String msg, T data){
        return new ServiceBean<>(success,msg,data);
    }

    public static ServiceBean resultSuccess(){

        return resultSuccess("");
    }
    public static ServiceBean resultFailed(){
        return resultFailed("");
    }

    public static ServiceBean resultSuccess(String msg){
        return new ServiceBean<>(true,msg,null);
    }
    public static ServiceBean resultFailed(String msg){
        return new ServiceBean<>(false,msg ,null);
    }

    public static ServiceBean resultMsg(boolean success, String msg){
        return new ServiceBean<>(success,msg,null);
    }

    public static<T> ServiceBean resultData(T data){
        return new ServiceBean<>(true,"",data);
    }

    public boolean opSuccess(Integer num){
        return num > 0;
    }
}
